package org.pms.servlet.administrators;

import org.pms.dao.AdministratorsDao;
import org.pms.dao.impl.AdministratorsDaoImplC3P0;
import org.pms.entity.Administrators;
import org.pms.servlet.BaseServlet;
import org.pms.vo.ResponseData;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 显示所有信息
 * @Date 2023-02-28
 * @Author 祝世栩
 */
@WebServlet("/administrators/selectAll.do")
public class SelectAll extends BaseServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 业务处理 - 数据库（查询、持久化数据） - DAO
        AdministratorsDao administratorsDao = new AdministratorsDaoImplC3P0();
        List<Administrators> list = administratorsDao.AdministratorsSelectAll();

        // 把处理的数据封装到统一的接口中
        ResponseData responseData = successJson(list);
        print(resp,responseData);
    }
}
